﻿
Ext.namespace('FantastPlatform', 'FantastPlatform.UI');
FantastPlatform.UI.CarDetails = function (config) {
    Ext.apply(this, config);
    this.items = [{
        layout: 'column',
        border: false,
        labelSeparator: '：',
        items: [{
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '号牌号码',
                name: 'Number',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '号牌种类',
                name: 'CarType',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '车主',
                name: 'PersonName',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '车辆状态',
                name: 'CarStates',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '住址',
                name: 'Address',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '邮政编码',
                name: 'PostNumber',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '电话号码',
                name: 'PhoneNumber',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '行政区划',
                name: 'AdministrativeDivision',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '销售单位',
                name: 'SalesUnit',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '产权',
                name: 'PropertyRight',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '证件名称',
                name: 'CertificateName',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '生产厂商',
                name: 'Manufacturer',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '证件号码',
                name: 'CertificateNumber',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '使用性质',
                name: 'UsedNature',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '车辆来历',
                name: 'CarFrom',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '车架号',
                name: 'Framenumber',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '发证机关',
                name: 'CertificateOrganization',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '发动机号',
                name: 'EngineNumber',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '出厂日期',
                name: 'OutDate',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '车身颜色',
                name: 'CarColor',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '登记日期',
                name: 'RegistrationDate',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '发证日期',
                name: 'CertificateDate',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '厂牌',
                name: 'CarLabel',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '登记证书',
                name: 'RegistrationCertificate',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '有效期至',
                name: 'EffectsTime',
                readOnly: true,
                anchor: '98%'
            })]
        }, {
            columnWidth: .5,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextField({
                fieldLabel: '报废日期',
                name: 'OffDate',
                readOnly: true,
                anchor: '98%'
            })]
        }]
    }];

    FantastPlatform.UI.CarDetails.superclass.constructor.call(this, {
        bodyStyle: 'padding:5px',
        collapsible: true,
        labelAlign: 'right',
        autoScroll: true,
        border: false
    });
};

Ext.extend(FantastPlatform.UI.CarDetails, Ext.form.FormPanel, {
    onRender: function (ct, position) {
        FantastPlatform.UI.CarDetails.superclass.onRender.call(this, ct, position);
        if (this.CarCheckId && this.CarCheckId != 0) {
            this.add(new Ext.form.Hidden({ name: 'Id', value: this.CarCheckId }));
            this.form.load({
                timeout: 10000,
                url: '../Service/CarSearchService.aspx?Action=GetDetails',
                params: { id: this.CarCheckId },
                waitMsg: '正在读取数据...',
                waitTitle: '请稍后...',
                failure: function (form, action) {
                    if (action.failureType != 'client') {
                        showErrorMessage('操作失败', action.result.message, '');
                    }
                }
            });
        }
    }
});

